import { eventHandler, readBody } from 'h3';
import { verifyAccessToken } from '~/utils/jwt-utils';

export default eventHandler(async (event) => {
  const userinfo = verifyAccessToken(event);
  if (!userinfo) {
    return { code: 401, message: '未授权访问' };
  }

  const body = await readBody(event);
  const { requestId } = body;

  // 模拟审批操作
  // 这里应该更新数据库，这里用模拟数据

  return {
    code: 200,
    data: {
      success: true,
      message: '审批成功',
    },
    message: '审批成功',
  };
});
